package com.rk.controller;
 
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.rk.service.LoginService;
 
@Controller
public class LoginController {
 
	private LoginService loginService;
	
	
	public LoginService getLoginService() {
		return loginService;
	}

	public void setLoginService(LoginService loginService) {
		this.loginService = loginService;
	}

	@RequestMapping(value="/login", method = RequestMethod.GET)
	public String login(ModelMap model) {
 
		return "login";
 
	}
	
	@RequestMapping(value="/homepage", method = RequestMethod.GET)
	public String homepage(ModelMap model) {
		loginService.getALLUserDetails();
		return "homepage";
 
	}
	
	@RequestMapping(value="/console", method = RequestMethod.GET)
	public String console(ModelMap model) {
 
		return "console";
 
	}
	@RequestMapping(value="/loginfailed", method = RequestMethod.GET)
	public String loginerror(ModelMap model) {
 
		model.addAttribute("error", "true");
		return "login";
 
	}

	@RequestMapping(value="/logout", method = RequestMethod.GET)
	public String logout(ModelMap model) {
 
		return "logout";
 
	}
	
}